{extend name="adminblue/base" /}
{block name="resources"/}
<script src="ADMIN_JS/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8" src="ADMIN_JS/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="ADMIN_JS/ueditor/ueditor.all.common.js"></script>
 {/block}
{block name="main"}
<div class="space-10"></div>
<div class="set-style">

	<h4>选择活动商品：</h4>
	
	<!-- 所有决定商品弹框内容的条件和存放商品id的隐藏域 -->
	<span id="goods-condition">
		<input type="hidden" name="type" value="2"/>
		<input type="hidden" name="stock" value="1"/>
		<input type="hidden" name="goods_type" value="1,2"/>
		<input type="hidden" name="is_have_sku" value="1"/>
		<input type="hidden" name="state" value="1"/>
		<input type="hidden" id="goods_id_array" value="{$info['goods_id_array'] ? $info['goods_id_array'] :''}">
		<input type="hidden" id="range_type" value="0">
		<input type="hidden" id="is_show_select" value="0">
	</span>
	{include file="adminblue/Promotion/goodsSelectDialog" /}

	<dl>
		<dt></dt>
		<dd>
			<button class="btn-common btn-big" onclick="updateDiscount();">保存</button>
			<!-- <button class="btn-common-cancle btn-big" onclick="window.location.href = window.history.go(-1);">返回</button> -->
		</dd>
	</dl>
</div>
<input type="hidden" id="topic_id" value="{$info['topic_id']}">
<script src="__STATIC__/js/ajax_file_upload.js" type="text/javascript"></script>
<script src="__STATIC__/js/file_upload.js" type="text/javascript"></script>
<script>

//保存
var flag = false;//防止重复提交
function updateDiscount(){
	var topic_id = $("#topic_id").val();
	var goods_id_array = $("#goods_id_array").val();
	flag = true;
	$.ajax({
		type : "post",
		url : "{:__URL('ADMIN_MAIN/promotion/editPromotionTopicGoods')}",
		data : {
			"topic_id" : topic_id,
			"goods_id_array" : goods_id_array,
		},
		success : function(data) {
			if (data["code"] > 0) {
				showMessage('success', data["message"],"{:__URL('ADMIN_MAIN/promotion/topiclist')}");
			}else{
				showMessage('error', data["message"]);
				flag = false;
			}
		}
	});
}


</script>
{/block}